home *** CD-ROM | disk | FTP | other *** search
/ Merciful 4 / Merciful - Disc 4.iso / rexx / slideshow.pprx < prev    next >
Text File  |  1996-11-01  |  6KB  |  224 lines

  1. /* Personal Paint Amiga Rexx script - Copyright © 1995-1996 Cloanto Italia srl */
  2.  
  3. /* $VER: Slideshow.pprx 1.0 */
  4.  
  5. /** ENG
  6.   This is a simple slideshow script. It normally displays all images
  7.   and animations which it finds in the specified directory (and
  8.   subdirectories).
  9.  
  10.   When the script is launched, it first searches for a file named
  11.   "T:pprx_slideshow.list". If this file exists, the script displays the
  12.   artwork files listed in the file. The file must contain two lines for
  13.   each image or animation: the first line containing the path, and the
  14.   second line indicating how often the item should be repeated (useful for
  15.   animations).
  16.  
  17.   To have a slideshow loop automatically and unattended, both the Repeat and
  18.   the Automatic options in the initial requester should be selected.
  19. */
  20.  
  21. /** DEU
  22.   Ein einfaches Skript zur Erzeugung einer Diaschau, welches
  23.   im Normalfall alle Bilder und Animationen im angegebenen Verzeichnis
  24.   (und in dessen Unterverzeichnissen) anzeigt.
  25.  
  26.   Sobald das Skript ausgeführt wird, sucht es zunächst eine Datei
  27.   namens "T:pprx_slideshow.list" und zeigt die darin enthaltenen
  28.   Bilder und Animationen an. Die Datei muß für jedes Bild (oder
  29.   jede Animation) jeweils zwei Zeilen enthalten: Die erste Zeile
  30.   enthält den Pfad, die zweite die gewünschte Anzahl von Wiederholungen
  31.   (besonders geeignet bei Animationen).
  32.  
  33.   Um eine automatisch endlos ablaufende Diaschau zu erzeugen,
  34.   müssen im ersten Dialogfenster die Optionen "Wiederholen" und
  35.   "Automatisch" aktiviert sein.
  36. */
  37.  
  38. IF ARG(1, EXISTS) THEN
  39.     PARSE ARG PPPORT
  40. ELSE
  41.     PPPORT = 'PPAINT'
  42.  
  43. IF ~SHOW('P', PPPORT) THEN DO
  44.     IF EXISTS('PPaint:PPaint') THEN DO
  45.         ADDRESS COMMAND 'Run >NIL: PPaint:PPaint'
  46.         DO 30 WHILE ~SHOW('P',PPPORT)
  47.              ADDRESS COMMAND 'Wait >NIL: 1 SEC'
  48.         END
  49.     END
  50.     ELSE DO
  51.         SAY "Personal Paint could not be loaded."
  52.         EXIT 10
  53.     END
  54. END
  55.  
  56. IF ~SHOW('P', PPPORT) THEN DO
  57.     SAY 'Personal Paint Rexx port could not be opened'
  58.     EXIT 10
  59. END
  60.  
  61. ADDRESS VALUE PPPORT
  62. OPTIONS RESULTS
  63. OPTIONS FAILAT 10000
  64.  
  65. Get 'LANG'
  66. IF RESULT = 1 THEN DO        /* Deutsch */
  67.     txt_title_filreq  = 'Grafikverzeichnis auswählen'
  68.     txt_title_options = 'Diaschau-Optionen'
  69.     txt_gad_repeat    = 'Wiede_rholen:'
  70.     txt_gad_auto      = 'Auto_matisch:'
  71.     txt_msg_stopped   = 'Diaschau wurde unterbrochen'
  72.     txt_msg_complete  = 'Diaschau beendet'
  73.     txt_err_oldclient = 'Für dieses Skript_ist eine neuere Version_von Personal Paint erforderlich'
  74.     txt_err_nolist    = 'Listendatei konnte nicht_geöffnet werden'
  75. END
  76. ELSE IF RESULT = 3 THEN DO    /* Français */
  77.     txt_title_filreq  = 'Choisir le répertoire des graphismes'
  78.     txt_title_options = 'Options de diaporama'
  79.     txt_gad_repeat    = '_Répéter :'
  80.     txt_gad_auto      = 'Auto_matique :'
  81.     txt_msg_stopped   = 'Le diaporama a été interrompu'
  82.     txt_msg_complete  = 'Diaporama terminé'
  83.     txt_err_oldclient = 'Ce script nécessite une nouvelle_version de Personal Paint'
  84.     txt_err_nolist    = "Impossible d'ouvrir le fichier de liste."
  85. END
  86. ELSE IF RESULT = 2 THEN DO    /* Italiano */
  87.     txt_title_filreq  = 'Selezionare cassetto immagini'
  88.     txt_title_options = 'Opzioni slideshow'
  89.     txt_gad_repeat    = '_Ripetuto:'
  90.     txt_gad_auto      = 'Auto_matico:'
  91.     txt_msg_stopped   = 'Lo slideshow è stato interrotto'
  92.     txt_msg_complete  = 'Slideshow terminato'
  93.     txt_err_oldclient = 'Questa procedura richiede_una versione più recente_di Personal Paint'
  94.     txt_err_nolist    = 'Il file indice non può essere aperto'
  95. END
  96. ELSE DO                /* English */
  97.     txt_title_filreq  = 'Select artwork directory'
  98.     txt_title_options = 'Slideshow Options'
  99.     txt_gad_repeat    = '_Repeat:'
  100.     txt_gad_auto      = 'Auto_matic:'
  101.     txt_msg_stopped   = 'The slideshow has been stopped'
  102.     txt_msg_complete  = 'Slideshow complete'
  103.     txt_err_oldclient = 'This script requires a newer_version of Personal Paint'
  104.     txt_err_nolist    = 'List file could not be opened'
  105. END
  106.  
  107. Version 'REXX'
  108. IF RESULT < 7 THEN DO
  109.     RequestNotify 'PROMPT "'txt_err_oldclient'"'
  110.     EXIT 10
  111. END
  112.  
  113. DeleteFrames 'ALL'
  114. IF RC = 5 THEN
  115.     EXIT 0
  116.  
  117. FreeEnvironment 'QUERY'
  118. IF RC = 5 THEN
  119.     EXIT 0
  120.  
  121. tmpfname = 'T:pprx_slideshow.list'
  122.  
  123. LockGUI
  124.  
  125. IF ~EXISTS(tmpfname) THEN DO
  126.     RequestPath '"'txt_title_filreq'"'
  127.     IF RC = 0 THEN DO
  128.         tmpfname = 'T:pprx_temp.'PRAGMA('ID')
  129.         ADDRESS COMMAND 'List >'tmpfname' 'RESULT' NOHEAD PAT=~(#?.info) LFORMAT="*"%s%s*"*N1" ALL FILES'
  130.     END
  131. END
  132.  
  133. originalbars = ''
  134. listopen = 0
  135. SIGNAL ON Break_C
  136.  
  137. IF EXISTS(tmpfname) THEN DO
  138.     Request '"'txt_title_options'" "CHECK = ""'txt_gad_repeat'"", 0  CHECK = ""'txt_gad_auto'"", 1 "'
  139.     IF RC = 0 THEN DO
  140.         repeat = RESULT.1
  141.         automatic = RESULT.2
  142.         IF automatic THEN
  143.             noprog = ''
  144.         ELSE
  145.             noprog = 'NOPROGRESS'
  146.  
  147.         Get 'BARS'
  148.         originalbars = RESULT
  149.         IF OPEN('listfile', tmpfname, 'R') THEN DO
  150.             listopen = 1
  151.             errcode = 0
  152.             Set '"BARS=0"'
  153.             DO FOREVER
  154.                 prevpos = SEEK('listfile', 0, CURRENT)
  155.                 curfname = READLN('listfile')
  156.                 IF EOF('listfile') THEN DO
  157.                     IF repeat THEN DO
  158.                         SEEK('listfile', 0, BEGIN)
  159.                         ITERATE
  160.                     END
  161.                     ELSE LEAVE
  162.                 END
  163.                 curtimes = READLN('listfile')
  164.                 IF EOF('listfile') THEN DO
  165.                     IF repeat THEN DO
  166.                         SEEK('listfile', 0, BEGIN)
  167.                         ITERATE
  168.                     END
  169.                     ELSE LEAVE
  170.                 END
  171.  
  172.                 IF DATATYPE(curtimes) ~= 'NUM' THEN curtimes = 1
  173.                 curtimes = ABS(curtimes)
  174.                 curtimes = TRUNC(curtimes)
  175.                 IF curtimes < 1 THEN curtimes = 1
  176.  
  177.                 GetFileFormat curfname
  178.                 IF RC = 0 THEN DO
  179.                     IF UPPER(RESULT) = 'ANIM' THEN
  180.                         PlayFile curfname 'TIMES' curtimes 'FORCE QUIET' noprog
  181.                     ELSE DO
  182.                         LoadImage curfname 'FORCE QUIET' noprog
  183.                         IF RC = 0 & automatic THEN
  184.                             ADDRESS COMMAND 'Wait >NIL: 3 SEC'
  185.                     END
  186.                     IF RC = 5 THEN
  187.                         errcode = 5
  188.                     IF RC = 0 & ~automatic THEN DO
  189.                         WaitForClick
  190.                         IF RC ~= 0 THEN
  191.                             errcode = 5
  192.                     END
  193.                 END
  194.                 IF errcode > 0 THEN BREAK
  195.             END
  196.             CALL CLOSE('listfile')
  197.             listopen = 0
  198.             IF errcode > 0 THEN
  199.                 RequestNotify 'PROMPT "'txt_msg_stopped'"'
  200.             ELSE
  201.                 RequestNotify 'PROMPT "'txt_msg_complete'"'
  202.         END
  203.         ELSE
  204.             RequestNotify 'PROMPT "'txt_err_nolist'"'
  205.  
  206.         Set '"BARS='originalbars'"'
  207.     END
  208.     ADDRESS COMMAND 'Delete >NIL: 'tmpfname
  209. END
  210. UnlockGUI
  211. EXIT 0
  212.  
  213.  
  214.  
  215. Break_C:
  216.  
  217.     if originalbars ~= '' THEN
  218.         Set '"BARS='originalbars'"'
  219.     IF listopen THEN
  220.         CALL CLOSE('listfile')
  221.     ADDRESS COMMAND 'Delete >NIL: 'tmpfname
  222.  
  223.     RETURN
  224.